/**
 * @param {number} k
 * @return {number}
 */
var getKthMagicNumber = function (k) {
  let suNum = [3, 5, 7]
  function isSu(val, temp = []) {
    for (let i = 2; i <= Math.sqrt(val); i++) {
      if (val % i == 0 && i % 2 != 0) {
        temp.push(val / i)
      }
    }
    for (let i = 0; i < temp.length; i++) {
      if (!suNum.includes(temp[i])) {
        return false
      }
    }

    return temp.length == 0 ? false : true
  }

  let arr = [1]
  let i = 2
  let count = 1
  while (count < k) {
    if (i == 3 || i == 5 || i == 7) {
      count++
      arr.push(i)
    } else {
      if (isSu(i)) {
        count++
        arr.push(i)
      }
    }

    i++
  }
  console.log(arr);
  return arr[k - 1]
}

console.log(getKthMagicNumber(11))
